﻿<!DOCTYPE html>
<html>
  <head>
    <title>登记信息审核</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <link href="resources/resources/css/jquery-ui-themes.css" type="text/css" rel="stylesheet"/>
    <link href="resources/resources/css/axure_rp_page.css" type="text/css" rel="stylesheet"/>
    <link href="resources/data/styles.css" type="text/css" rel="stylesheet"/>
    <link href="resources/files/登记信息审核/styles.css" type="text/css" rel="stylesheet"/>
    <script src="resources/resources/scripts/jquery-1.7.1.min.js"></script>
    <script src="resources/resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
    <style>
        #u896 {
          border-width:0px;
          position:absolute;
          left:350px;
          top:434px;
          width:58px;
          height:29px;
        }
        #u897 {
          border-width:0px;
          position:absolute;
          left:430px;
          top:434px;
          width:58px;
          height:29px;
        }
        table,td,th{
            border: 1px solid;
            border-collapse: collapse;
            word-wrap:break-word;
            font-size: 13px;
        }
        th{
            background: #ccc;
        }
        table tr:nth-child(odd){
            background: #80b7cc;
        }
        #dataTable{
            border-width:0px;
            position:absolute;
            left:358px;
            top:183px;
            width:694px;
            text-align: center;
        }
        #dataTable tr{
            height: 30px;
        }
        #pages {
            padding: 0px;
            position: absolute;
            left: 540px;
            top: 420px;
            list-style: none;
            width: 350px;
            height: 25px;
            border: 2px solid rgba(121, 121, 121, 1);
            border-radius: 5px;
            line-height: 25px;
            text-align: center;
        }
        #pages  li{
            display: inline-block;
            width: 50px;
            cursor: pointer;
        }
        #pages li:hover{
            background-color: whitesmoke;
        }

    </style>
  </head>

  <body>
      <div id="base" class="">
        <div id="page"></div>
        <div>
          <table id="dataTable">
            <thead>
              <tr>
                  <th width="40"></th>
                  <th width="80">编号</th>
                  <th width="150">单位名称</th>
                  <th width="80">姓名</th>
                  <th width="120">联系方式</th>
                  <th width="120">提交时间</th>
                  <th width="80">详情</th>
                  <th width="80">审核员</th>
                  <th width="80">审核状态</th>
              </tr>
            </thead>
            <tbody>

            </tbody>
          </table>
        </div>
        <!-- Unnamed (矩形) -->
        <div id="u827" class="ax_default box_1">
          <div id="u827_div" class=""></div>
          <div id="u827_text" class="text ">
            <p><span>流动人口服务管理系统</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u877" class="ax_default box_3">
          <div id="u877_div" class=""></div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u878" class="ax_default box_1">
          <div id="u878_div" class=""></div>
          <div id="u878_text" class="text ">
            <p><span>注册信息审核</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u879" class="ax_default box_1">
          <div id="u879_div" class=""></div>
          <div id="u879_text" class="text ">
            <p><span>登记信息审核</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u880" class="ax_default box_1">
          <div id="u880_div" class=""></div>
          <div id="u880_text" class="text ">
            <p><span>流动人口信息管理</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u881" class="ax_default box_1">
          <div id="u881_div" class=""></div>
          <div id="u881_text" class="text ">
            <p><span>账户管理</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u882" onclick="loadPersonalInformation(1)" class="ax_default primary_button">
          <div id="u882_div" class=""></div>
          <div id="u882_text" class="text ">
            <p><span>搜索</span></p>
          </div>
        </div>

        <!-- Unnamed (文本框) -->
        <div id="u883" class="ax_default text_field">
          <input id="u883_input" type="text" value="" placeholder="请输入单位名称/姓名/联系方式/提交时间筛选"/>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u896" onclick="check(2)" class="ax_default button">
          <div id="u896_div" class=""></div>
          <div id="u896_text" class="text ">
            <p><span>通过审核</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u897" onclick="check(0)" class="ax_default button">
          <div id="u897_div" class=""></div>
          <div id="u897_text" class="text ">
            <p><span>不通过</span></p>
          </div>
        </div>

        <!-- Unnamed (矩形) -->
        <div id="u898" class="ax_default box_1">
          <div id="u898_div" class=""></div>
          <div id="u898_text" class="text ">
            <p><span>流动人口信息统计</span></p>
          </div>
        </div>

      </div>
    </body>
<script>
    var session = "";
    $(function() {
        $.ajax({
            url:"/getSession",
            dataType:"json",
            type:"post",
            async:false,
            success:function(data) {
                session = data;
            }
        });
        if(session==1){
            $.ajax({
                url:"/getSessionTown",
                dataType:"json",
                type:"post",
                async:false,
                success:function(data) {
                    session = data;
                }
            });
        }else if(session==2){
            $.ajax({
                url:"/getSessionTown",
                dataType:"json",
                type:"post",
                async:false,
                success:function(data) {
                    session = data;
                }
            });
        }else if(session==3){

        }
        loadPersonalInformation(1);
    })

    function show(id) {
        window.location.href = "/toPersonalMessageShow?id="+id;
    }
    /**
     * 审核
     */
    function check(isTrue) {
        var formData = new FormData();
        var checkInputArr = $("input[name='checkId']:checked");
        var idArr = new Array();
        $.each(checkInputArr,function(index,item) {
            idArr.push($(item).val());
        })

        if(idArr.length>0){
            formData.append("ids",idArr);
            formData.append("isTrue",isTrue);
            if(isTrue==0){//不通过
                var reason = noPass();
                formData.append("reason",reason);
            }
            $.ajax({
                url:"/check",
                dataType:"json",
                type:"post",
                traditional:true,
                data:formData,
                processData:false,
                contentType:false,
                success:function(data) {
                    alert("审核完成"+data+"条");
                    loadPersonalInformation(1);
                }
            })
        }else {
            alert("请先选择");
        }
    }
    /**
     * 不通过+++++++
     */
    function noPass(){
    	var reason=prompt("原因：");
    	if (reason!=null && reason!=""){
    	    return reason;
    	}
    }
    /**
     * 模糊查询个人信息表+分页
     */
    function loadPersonalInformation(pageNum) {
        if(pageNum==""||pageNum==undefined){
            pageNum = 1;
        }
        var search = $("#u883_input").val();
        $.ajax({
            url:"/loadPersonalInformation",
            data:{search:search,pageNum:pageNum},
            dataType:"json",
            type:"post",
            success:function(data) {
                var tbody = $("tbody");
                tbody.empty();
                var html = "";
                $.each(data.list,function(index,item) {
                    html += '<tr>'+
                            '<td width="40"><input type="checkbox" value="'+item.id+'" '+(item.auditState==2?"disabled":item.auditState==0?"disabled":"")+' name="checkId"></td>'+
                            '<td width="80">'+(item.id==undefined?"":item.id)+'</td>'+
                            '<td width="150">'+(item.unitName==undefined?"":item.unitName)+'</td>'+
                            '<td width="80">'+(item.name==undefined?"":item.name)+'</td>'+
                            '<td width="120">'+(item.personalMobilePhone==undefined?"":item.personalMobilePhone)+'</td>'+
                            '<td width="120">'+(item.submitTime==undefined?"":item.submitTime)+'</td>'+
                            '<td width="80" onclick="show('+item.id+')">查看详情</td>'+
                            '<td width="80"></td>'+
                            '<td width="80">'+(item.auditState==0?"不通过":item.auditState==2?"通过":"未审核")+'</td>'+
                            '</tr>'
                })
                var select = "";
                var page = '<ul id="pages" class="ax_default">'+
                           '<li onclick="loadPersonalInformation(1)"><span>首页</span></li>'+
                           '<li onclick="loadPersonalInformation('+(data.hasPreviousPage?data.prePage:1)+')"><span>上一页</span></li>'+
                           '<li onclick="loadPersonalInformation('+(data.hasNextPage?data.nextPage:data.pages)+')"><span>下一页</span></li>'+
                           '<li onclick="loadPersonalInformation('+(data.pages)+')"><span>尾页</span></li>'+
                           '<li><span>共'+(data.pages)+'页</span></li>'+
                           '<li><span>第'+(data.pageNum)+'页</span></li>'+
                           '</ul>';

                tbody.append(html);
                $("#page").empty();
                $("#page").append(page);
            }
        })
    }
</script>
</html>
